import request from '@/utils/request'

// 获取文章分类
export const articleClassficationGetService = () => {
  return request({
    url: '/my/cate/list'
  })
}

// 添加文章分类
export const articleClassficationAddService = ({ cate_name, cate_alias }) => {
  return request({
    url: '/my/cate/add',
    method: 'POST',
    data: {
      cate_name,
      cate_alias
    }
  })
}

// 编辑文章分类
export const articleClassficationEditService = ({ id, cate_name, cate_alias }) => {
  return request({
    url: '/my/cate/info',
    method: 'PUT',
    data: {
      id,
      cate_name,
      cate_alias
    }
  })
}

// 删除文章分类
export const articleClassficationDelServe = (id) => {
  return request({
    url: '/my/cate/del',
    method: 'DELETE',
    params: {
      id
    }
  })
}

// 获取文章列表
export const artListGetService = (obj) => {
  return request({
    url: '/my/article/list',
    params: obj
  })
}

// 发布文章
export const artSubmitService = (formObj) => {
  return request({
    url: '/my/article/add',
    method: 'POST',
    data: formObj
  })
}

// 获取文章详情
export const artGetFullService = (id) => {
  return request({
    url: '/my/article/info',
    params: {
      id
    }
  })
}

// 更新文章详情
export const artResetService = (formObj) => {
  return request({
    url: '/my/article/info',
    method: 'PUT',
    data: formObj
  })
}